{% extends "base.html" %}
{% load staticfiles %}


{% block title %}
    图灵系统 - 下载专区
{% endblock %}



{% block style %}
<link rel="stylesheet" type="text/css" href="/static/uploadify/uploadify.css">
{% endblock %}



{% block content %}
<div class="container question"  style="height: 100%">
	<div id="uploadDiv" style="position:fixed;
			display:none;
			width:100%;
			height:100%;
			z-index:9999;
			opacity:0.6;
			background-color: white;
			top:0;
			left:0;">
	</div>
	<div id="uploadReg" style="position: absolute;
							display: none;
    						left: 25%;
    						top: 50%;
    						background: white;
    						width: 50%;
    						height: auto;
    						border: 3px solid #444;
    						border-radius: 7px;
    						z-index: 10000;"
                            >
    	<div style="margin: 10px 10px; text-align: center;">
          <input id="file_upload" type="file" name="Filedata" style="margin:0; vertical-align: middle; width: 200px; display:inline">
          <div id="file_uploadQueue" class="uploadifyQueue"></div>
          <p><span id="id_span_msg"></span></p>
       	</div>
       	<div style="margin: 50px 20px;">
       		<label>说明：
       			<p>

       					点击上传按钮选择上传文件，选择文件后将自动开始上传,
                        完成上传后点击结束按钮回到下载专区，上传文件的文件名为"原文件名_上传时间_上传人"

       			</p>
       		</label>
             	<button onclick="window.location='/DownloadArea/'" style="margin:0 auto; display:inline" class="upload-button pull-right" >
       			结束
       		</button>
       	</div>

    </div>
    <div class="row">
        <br>
        <div class="col-md-12">
        	<div class="panel panel-default" style="border: none;">
        		<div class="panel-heading">
        			当前位置：下载专区
			        {% if super %}
					        <button onclick="$('#uploadReg').slideToggle(500);$('#uploadDiv').css('display','inline');" class="pull-right upload-button">
						               上传文件
					        </button>
					    {% endif %}
			      </div>
			    <div class="panel-body">
			    	<table id="DataTable_DownloadArea" class="table table-hover" style="border: none;">
						<thead>
							<tr style="display: none;">
								<th width="5px;"></th>
								<th width="90px;"></th>
								<th></th>
							</tr>
						</thead>

						<tbody>
							{% for File in fileList %}
							<tr>
								<td></td>
								<td>
										<a style="text-decoration: none;color: #313c2c; font-size: 16px;">{{File.FileName}}</a>
								</td>
                <td></td>
                <td>
                  下载量：
									<span id="downloadNum" style="color: #313c2c; font-size: 16px;">
										{{File.DownloadNum}}
									</span>
								</td>
								<td id="{{File.FileName}}">
									<button class="downloadFile download-button " style="font-size: 14px;">
										下载
									</button>
									{% if super %}
									<button class="deleteFile download-button" style="font-size: 14px;">
										删除
									</button>
									{% endif %}
								</td>
							</tr>
							{% endfor %}
						</tbody>
					</table>
			    </div>
        	</div>
		</div>
	</div>
</div>
{% endblock %}



{% block other_script %}
<script type="text/javascript" src="/static/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="/static/uploadify/uploadify.js"></script>
{% endblock %}
